package dz.chuxin.app.sample;

import android.widget.Toast;

import java.util.ArrayList;
import java.util.List;

import dz.chuxin.app.R;
import dz.chuxin.app.core.BaseActivity;
import dz.chuxin.framework.widget.rowview.BaseRowDescriptor;
import dz.chuxin.framework.widget.rowview.NormalRowDescriptor;
import dz.chuxin.framework.widget.rowview.OnRowClickListener;
import dz.chuxin.framework.widget.rowview.RowGroupContainerView;
import dz.chuxin.framework.widget.rowview.RowViewGroupDescriptor;

/**
 * Created by chuxin on 2016/7/17.
 */
public class RowViewActivity extends BaseActivity implements OnRowClickListener {

    private RowGroupContainerView mRowGroupContainerView;

    @Override
    protected void setUpContentView() {
        setContentView(R.layout.activity_row, R.string.app_name);
        mRowGroupContainerView = (RowGroupContainerView) findViewById(R.id.row_view_container);

        List<BaseRowDescriptor> rowDescriptors = new ArrayList<>();
        rowDescriptors.add(new NormalRowDescriptor(1, R.mipmap.ic_launcher, "我的相册"));
        rowDescriptors.add(new NormalRowDescriptor(2, R.mipmap.ic_launcher, "我的文章"));
        rowDescriptors.add(new NormalRowDescriptor(3, false, R.mipmap.ic_launcher, "金币"));
        RowViewGroupDescriptor groupDescriptor = new RowViewGroupDescriptor("", rowDescriptors);

        List<BaseRowDescriptor> rowDescriptors2 = new ArrayList<>();
        rowDescriptors2.add(new NormalRowDescriptor(4, R.mipmap.ic_launcher, "设置"));
        rowDescriptors2.add(new NormalRowDescriptor(5, "关于我们"));
        RowViewGroupDescriptor groupDescriptor2 = new RowViewGroupDescriptor("", rowDescriptors2);

        mRowGroupContainerView.stuffData(this, groupDescriptor, groupDescriptor2);
    }

    @Override
    public void onRowClick(BaseRowDescriptor rowDescriptor) {
        Toast.makeText(this, "Row：" + rowDescriptor.getRowId(), Toast.LENGTH_SHORT).show();
    }
}
